package com.kaka.starter.token.service;

import com.kaka.starter.token.dto.TokenDTO;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author kaka
 * @Date 2020-07-03
 */
public class TokenCheckService {

    @Autowired
    private TokenService tokenService;

    public boolean check(TokenDTO tokenDTO) {
        TokenDTO dto = tokenService.get(tokenDTO.getId());
        return dto != null && tokenDTO.getToken().equals(dto.getToken());
    }
}
